package com.ruoyi.inventory.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.InventoryTransactionMapper;
import com.ruoyi.inventory.domain.InventoryTransaction;
import com.ruoyi.inventory.service.IInventoryTransactionService;
import com.ruoyi.common.core.text.Convert;

/**
 * 库存流水Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-23
 */
@Service
public class InventoryTransactionServiceImpl implements IInventoryTransactionService 
{
    @Autowired
    private InventoryTransactionMapper inventoryTransactionMapper;

    /**
     * 查询库存流水
     * 
     * @param transactionId 库存流水主键
     * @return 库存流水
     */
    @Override
    public InventoryTransaction selectInventoryTransactionByTransactionId(Long transactionId)
    {
        return inventoryTransactionMapper.selectInventoryTransactionByTransactionId(transactionId);
    }

    /**
     * 查询库存流水列表
     * 
     * @param inventoryTransaction 库存流水
     * @return 库存流水
     */
    @Override
    public List<InventoryTransaction> selectInventoryTransactionList(InventoryTransaction inventoryTransaction)
    {
        return inventoryTransactionMapper.selectInventoryTransactionList(inventoryTransaction);
    }

    /**
     * 新增库存流水
     * 
     * @param inventoryTransaction 库存流水
     * @return 结果
     */
    @Override
    public int insertInventoryTransaction(InventoryTransaction inventoryTransaction)
    {
        inventoryTransaction.setCreateTime(DateUtils.getNowDate());
        return inventoryTransactionMapper.insertInventoryTransaction(inventoryTransaction);
    }

    /**
     * 修改库存流水
     * 
     * @param inventoryTransaction 库存流水
     * @return 结果
     */
    @Override
    public int updateInventoryTransaction(InventoryTransaction inventoryTransaction)
    {
        return inventoryTransactionMapper.updateInventoryTransaction(inventoryTransaction);
    }

    /**
     * 批量删除库存流水
     * 
     * @param transactionIds 需要删除的库存流水主键
     * @return 结果
     */
    @Override
    public int deleteInventoryTransactionByTransactionIds(String transactionIds)
    {
        return inventoryTransactionMapper.deleteInventoryTransactionByTransactionIds(Convert.toStrArray(transactionIds));
    }

    /**
     * 删除库存流水信息
     * 
     * @param transactionId 库存流水主键
     * @return 结果
     */
    @Override
    public int deleteInventoryTransactionByTransactionId(Long transactionId)
    {
        return inventoryTransactionMapper.deleteInventoryTransactionByTransactionId(transactionId);
    }
}
